<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>Geocaching Tour Planner</title>
<!-- Get our styles here -->
<link type="text/css" rel="stylesheet" href="map.css" id="mapss">

<script src=" http://maps.google.com/?file=api&amp;v=2.x&amp;key=ABQIAAAAjyXLt7xcxpmvRyMTawa0XhQgZJysIXBCI10Gq9izJ2r_e-ml4BTB2RTimXNawoCoMiJf_dpijRWoLg"
		type="text/javascript">
</script>

<script type="text/javascript">
	/* Google's variables */
	var map;
	var gdir;
	var geocoder = null;
	var addressMarker;
 
	function initialize() 
	{
		/* The Google Maps initialization */
		if (GBrowserIsCompatible()) 
		{
			map = new GMap2(document.getElementById("map_canvas"));
			gdir = new GDirections(map, document.getElementById("directions"));
			GEvent.addListener(gdir, "load", onGDirectionsLoad);
			GEvent.addListener(gdir, "error", handleErrors);
			var mapControl = new GMapTypeControl();
			map.addControl(mapControl);
			map.addControl(new GLargeMapControl());
		}
	}
	
	function setDirectionsFromArray(wpArray, travelMethod) 
	{
		if (travelMethod == "w")
			gdir.loadFromWaypoints(wpArray, {getPolyline:true,getSteps:true,travelMode:G_TRAVEL_MODE_WALKING});
		else
			gdir.loadFromWaypoints(wpArray, {getPolyline:true,getSteps:true,travelMode:G_TRAVEL_MODE_DRIVING});
	}

	function handleErrors() 
	{
		if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
			window.HenryController.showMessage_("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: "
					+ gdir.getStatus().code);
		else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
			window.HenryController.showMessage_("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: "
					+ gdir.getStatus().code);

		else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
			window.HenryController.showMessage_("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: "
					+ gdir.getStatus().code);

		else if (gdir.getStatus().code == G_GEO_BAD_KEY)
			window.HenryController.showMessage_("The given key is either invalid or does not match the domain for which it was given. \n Error code: "
					+ gdir.getStatus().code);
		else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
			window.HenryController.showMessage_("A directions request could not be successfully parsed.\n Error code: "
					+ gdir.getStatus().code);
		else
			window.HenryController.showMessage_("An unknown error occurred.");
	}

	function onGDirectionsLoad()
	{ 
	      // Use this function to access information about the latest load()
	      // results.

	      // e.g.
	      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
		  // and yada yada yada...
		}

</script>
</head>
<body onload="initialize();">
	<input id="message_button" type="button" value="Back" onClick="window.HenryController.goBack_('nothing');" />
	<input id="message_button" type="button" value="Forward" onClick="window.HenryController.goForward_('nothing');" />

	<table class="directions_table">
		<tr>
			<th>Turn-by-Turn Directions</th>
			<th>Map</th>
		</tr>
		<tr>
			<td valign="top">
				<div id="directions" style="width: 275px"></div>
			</td>
			<td valign="top">
				<div id="map_canvas" style="width: 1000px; height: 600px"></div>
			</td>
		</tr>
	</table>
</body>
</html>
